package com.ironman.mes.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * description
 * company 铁人科技
 *
 * @author 陈浩杰
 * @date 2023/1/31 13:38
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Res<T> implements Serializable {

    private static final long serialVersionUID = -3243475556181265119L;

    private String code;

    private String msg;

    private T data;

    public static Res<Void> ok() {
        return new Res<>("0", "success", null);
    }

    public static <T> Res<T> ok(T data) {
        return new Res<>("0", "success", data);
    }

    public static Res<String> failure(String code, String message) {
        return new Res<>(code, message, null);
    }

}
